<?php 
$weekarr = array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday");
$week = $weekarr[date("w")];
?>
<div id="company" class="indexcontentdiv">
    <div class="positiondiv">
        <table>
            <tr>
                <td class="td-left">
                    <img src="<?=base_url()?>resource/img/home_ico.png" width="21" height="17">
                    Data Entry > <a href="<?=base_url()?>index/company">Comany</a> > New Company
                </td>
                <td class="td-right">
                    <img src="<?=base_url()?>resource/img/menu2.png" width="27" height="24">Today is <?=$week?>,<?=date('M d,Y')?>
                </td>
            </tr>
        </table>
    </div>
    <div class="input-div">
        <?php echo form_open_multipart('index/new_company'); ?>
        <input type="hidden" name="type" value="1" />
        <table>
            <tr><td></td><td><span class="err"><?=validation_errors();?><?php if(isset($error)){echo $error;}?></span></td></tr>
            <tr><td colspan="2"><h3>.Company</h3></td></tr>
            <tr><td class="nametd">SN:</td><td><input type="text" name="sn"/></td></tr>
            <tr><td class="nametd">UEN:</td><td><input type="text" name="uen"/></td></tr>
            <tr><td class="nametd">Company Name:</td><td><input type="text" name="name"/><span class="err">*</span></td></tr>
            <tr>
                <td class="nametd">Industry:</td>
                <td>
                    <select name="industry" id="industry" style="width:140px;">
                        <option value="0">-Industry-
                        <?php foreach ($industry as $key => $value) {?>
                            <option value="<?=$value['id']?>"><?=$value['name']?>
                        <?php }?>
                    </select>
                </td>
            </tr>
            <tr><td class="nametd">Contact Person:</td><td><input type="text" name="person"/></td></tr>
            <tr><td class="nametd">Position:</td><td><input type="text" name="position"/></td></tr>
            <tr><td class="nametd">Contact No:</td><td><input type="text" name="number"/></td></tr>
            <tr><td class="nametd">Email:</td><td><input type="text" name="email"/></td></tr>
            <tr><td class="nametd">Contact Status:</td>
                <td>
                    <select name="status">
                        <option value="0">-Select-
                        <option value="1">Positive
                        <option value="2">Neutral
                        <option value="3">Hostile
                    </select>
                </td>
            </tr>
            <tr><td class="nametd">Comments:</td>
                <td>
                    <textarea name="comment"></textarea>
                </td>
            </tr>
            <tr>
                <td></td>
                <td>
                    <input type="submit" value="Save"/>
                    <input type="button" value="Reset"/>
                </td>
            </tr>
        </table>
        <?php echo form_close(); ?>
    </div>
</div>
<script>
$("input[name='name']").focus(function(){
}).blur(function(){
    if($(this).val() == ''){
        alert("Name can not be empty！");
    }
});

$("input[type='button']").click(function(){
    $("input[name='sn']").val('');
    $("input[name='name']").val('');
    $("#industry").val(0);
    $("input[name='person']").val('');
    $("input[name='position']").val('');
    $("input[name='number']").val('');
    $("input[name='email']").val('');
    $("textarea[name='comment']").val('');
});
</script>
　